function view=readView_ver_0004(path,filename)
	pFile = fopen([ path '/' filename]);
	if pFile == -1
		fprintf('can not open file %s',[path '/' filename]);
	end
	version = str2num(fgetl(pFile));
	if version ~= 4
		fprintf(' can not read version %d, need version 0004', version);
	view.P = zeros(12,1);
	view.width = 0;
	view.height = 0;
	view.pan = 0;
	view.tilt = 0;
	view.roll = 0;
	view.scale = 0;
	view.dx = 0;
	view.dy = 0;
	view.eye = 0;
    view.cam_dir = 0;
        return;
	end
	filename = fgetl(pFile);

	% image size
	txt_line = fgetl(pFile);
	data = sscanf(txt_line,'%f,');
	width = data(1); height = data(2);
	
	% object size;
	txt_line = fgetl(pFile);
	
	
	% solve P matrix
	txt_line = fgetl(pFile);
	data = sscanf(txt_line,'%f,');
	x = reshape(data,[2 7]);
    x = [x;ones(1,7)];
    X = [1 0 0; 0 1 0;0 0 1; 0 0 0; -1 0 0; 0 -1 0; 1 1 1]*25.4*4; % unit is mm
    X = [X'; ones(1,7)];
	%P1 = x*X'*inv(X*X');
	%P=x/X;
    P = DLTProjection(X,x);
    % extract camera direction
    txt_line = fgetl(pFile);
    cam_dir = sscanf(txt_line,'%f,');
    cam_dir = cam_dir./norm(cam_dir);
    
	% parse pan tilt roll etc
	txt_line = fgetl(pFile);
	data = sscanf(txt_line,'%f,');
	pan = data(1)/180*pi;
	tilt = data(2)/180*pi;
	roll = data(3)/180*pi;
	
	scale = data(4);
	dx = data(5);
	dy = data(6);
	
	% parse camera center
	txt_line = fgetl(pFile);
	data = sscanf(txt_line,'%f,');
	eye = data'*25.4; % change to mm from inch
	
	% output
	view.P = P;
	view.width = width;
	view.height = height;
	view.pan = pan;
	view.tilt = tilt;
	view.roll = roll;
	view.scale = scale;
	view.dx = dx;
	view.dy = dy;
	view.eye = eye;
    view.cam_dir = cam_dir;
	fclose(pFile);
end